<#include "/lib/macro-lib.ftl"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>公众信息网管理系统  - 修改文章</title>
<#include "../inc/commonJs.html">
<script type="text/javascript" charset="utf-8" src="${request.contextPath}/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${request.contextPath}/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${request.contextPath}/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body > 
<div align="center" class="easyui-panel" data-options='fit:true,border:false'>
<form name="form1" method="post" action="newsEditSave.do?newsid=${obj.id}" OnSubmit="return checkdata(this);">
<table class="table_all" border="0" cellspacing="0" width="98%" cellpadding="0" >
	<input name="type" type="hidden" value="${type}" />
    <input name="typeid" id="typeid" type="hidden" value="${obj.typeid}" />
	<tr height="25">
	<td align="right" class="td_table_1" valign="middle" width="100"><font color="#FF0000">*</font>文章标题：</td>
		<td class="td_table_2"> 
			<input name="title"  class="easyui-validatebox" required="true" missingMessage="请填写文章标题" value="${obj.title}" type="TEXT" size=50 maxlength=100 style=" height:22;background-color:ffffff;border: 1 double; border-color:#BDD0FD;"  onMouseOver="window.status='在这里输入要添加的文章标题，必填';return true;" onMouseOut="window.status='';return true;" title='在这里输入要添加的文章标题，必填'>
			<SELECT size=1 id=title_color name=titlecolor style="width:55; background-color:#FFF;">
			<OPTION value="" selected>颜色</OPTION>
			<OPTION value="">缺省</OPTION>
			<OPTION value="#008000" style="background-color:#008000"></OPTION>
			<OPTION value="#800000" style="background-color:#800000"></OPTION>
			<OPTION value="#808000" style="background-color:#808000"></OPTION>
			<OPTION value="#000080" style="background-color:#000080"></OPTION>
			<OPTION value="#800080" style="background-color:#800080"></OPTION>
			<OPTION value="#808080" style="background-color:#808080"></OPTION>
			<OPTION value="#FFFF00" style="background-color:#FFFF00"></OPTION>
			<OPTION value="#00FF00" style="background-color:#00FF00"></OPTION>
			<OPTION value="#00FFFF" style="background-color:#00FFFF"></OPTION>
			<OPTION value="#FF00FF" style="background-color:#FF00FF"></OPTION>
			<OPTION value="#FF0000" style="background-color:#FF0000"></OPTION>
			<OPTION value="#0000FF" style="background-color:#0000FF"></OPTION>
			<OPTION value="#008080" style="background-color:#008080"></OPTION>
			</SELECT>
		</td>
			<td class="td_table_1" width="100">栏目名称：</td>
			<td colspan="3" class="td_table_2"><span id="typename">${obj.typename}</span>
				<input class="button_70px" type="button" onclick="dotype()" value="修改栏目" >
			</td>
	</tr>
	<tr height="25"> 
		<td align="right" class="td_table_1" valign="middle" >副标题：</td>
		<td class="td_table_2"> 
			<input name="titleface" id=title_face type="TEXT" value="${obj.titleface!}" size=50 maxlength=100 style=" height:22;background-color:ffffff;border: 1 double; border-color:#BDD0FD;" title='文章为医务人员时，填写职称；为医疗设备时，填写主治病症'>
			(文章为医务人员时，填写职称；为医疗设备时，填写主治病症)
		</td>
     <td align="right" class="td_table_1" valign="middle" >二级栏目：</td>
     <td class="td_table_2">
		<@selectUtil optName='typeid2' optVals=xxejlm optVal='${obj.typeid2}' all=true/>
     </td>
    </tr>
	<tr height="25"> 
		<td align="right" class="td_table_1" valign="middle">图片视频：</td>
	    <td class="td_table_2">
	    	<input type=hidden name=d_savefilename id=d_savefilename value="" onChange="doChange(this,document.form1.piclist)" />
	    	<input name="picurl" type="text" id="picurl" size="50" maxlength="200" value="${obj.picname!}" style=" height:22;background-color:ffffff;border: 1 double; border-color:#BDD0FD;">
			<input class="button_70px" type="button" onclick="doUpload()" value="上传文件" >&nbsp;&nbsp;
			<#if obj.picname??&&obj.picname!=''><a href="${request.contextPath}/uploadfile/${obj.picname}" target="_blank">查看文件</a></#if>
		</td>
    	<td align="right" class="td_table_1" valign="middle" >发布日期：</td>
    	<td class="td_table_2">
        	<input value="${obj.updatetime?substring(0,10)}" name="updatetime" id="UpdateTime" type="TEXT" size=30 onClick="calendar.show(this);" style=" height:22;background-color:ffffff;border: 1 double; border-color:#BDD0FD;">  
		</td>
	</tr>
    <tr height="25"> 
      <td align="right" class="td_table_1" valign="middle" >作者（附加）：</td>
      <td class="td_table_2">
        <input name="author" id=mess type="TEXT" value="${obj.author}" size=50 maxlength=100 style=" height:22;background-color:ffffff;border: 1 double; border-color:#BDD0FD;" title='文章为医务人员时，填写附加内容'>
      </td>
      <td align="right" class="td_table_1" >来源（科室）：</td>
      <td class="td_table_2">
        <input name="original" id=message type="TEXT" value="${obj.original!}" size=50 maxlength=100 style=" height:22;background-color:ffffff;border: 1 double; border-color:#BDD0FD;" title='文章为医疗设备时，填写所属科室'>
      </td>
    </tr>
    <tr height="25"> 
	      <td class="td_table_1" valign="middle"><font color="#FF0000">*</font>文章内容：</td>
	      <td align="left" class="td_table_2" colspan="3">
	      	<script id="content" name="content" type="text/plain" style="width:100%;height:300px;">${obj.content!}</script>
		  </td>
    </tr>
	<tr align="center" height="25"> 
		<td colspan="4" height="25" class="td_table_2">
		<div  align="center">
		<input name="encode" type="hidden" value="html">
		<input class="button_70px" type="submit" value=" 修改" name="Submit" >&nbsp; 
		<input class="button_70px" type="button" value="关闭" name="button" onclick="window.parent.$('#tabs').tabs('close','编辑信息');" >
	 	</td>
	</tr>
</table>
</form>
</div>
<div  id="typeWindow" >
	<form id="typeForm" method="post">
		<ul id="typetree" class="easyui-tree"></ul>  
	</form>
</div>
<div  id="updateWindow" >
	<form id="uploadForm" method="post" enctype="multipart/form-data">
		<table class="table_all" border="0" cellspacing="0" width="90%" cellpadding="0" align="center">
			<tr> 
				<td class="td_table_1">上传文件：</td>
				<td class="td_table_2" >
					<input type="hidden" id="id" name="id" />
					<input type="file" name="imgfile" value="浏览"><br>【注】请上图片的传格式为 jpg 或 gif；视频为 mp4
				</td>
			</tr>
		</table>
	</form>
</div>
</body>
</html>
<script type="text/javascript">
var ue = UE.getEditor('content');
function checkdata(f) {
	if(!ue.hasContents()) {
		top.messagershow('请填写文章内容');
		ue.focus();
		return false;
	}
	return true;
}

$(function(){
	$('#updateWindow').dialog({
	    title: '上传图片',
	    width: 450,
	    zIndex:999,
	    modal: true,
	    closed: true,
	    inline:true,
	    shadow:false,
	    buttons:[{
			text:'上传',
			iconCls:'icon-ok',
			handler:function(){
				$('#uploadForm').form('submit', {
				    url:'addNewsImg.do',
				    onSubmit: function(param){
				    	return $(this).form('validate');
				    },
				    success:function(data){
				    	$("#updateWindow").dialog('close');
				    	$("#picurl").val(data);
				    }    
				}); 
			}
		},{
			text:'关闭',
			iconCls:'icon-cancel',
			handler:function(){
				$("#updateWindow").dialog('close');
			}
		}]
	});
	$('#typeWindow').dialog({
	    title: '修改栏目',
	    width: 350,
	    height:400,
	    zIndex:999,
	    modal: true,
	    closed: true,
	    inline:true,
	    //shadow:false,
	});
	$('#typetree').tree({
		url:'typeTree.do',
	    lines:true,
	    animate:true,
	    onClick: function(node){
			//alert(node.text);
			$('#typeForm').form('submit', {
			    url:'updateType.do?newsid=${obj.id}&typeid='+node.id,
			    onSubmit: function(param){
			    	return $(this).form('validate');
			    },
			    success:function(data){
			    	$("#typeWindow").dialog('close');
			    	$("#typeid").val(node.id);
			    	$("#typename").text(node.text);
			    	top.messagershow('栏目修改成功');
			    }    
			}); 
		}
	});
});
function dotype(){
	$("#typeWindow").dialog('open').dialog('center');
}
function doUpload(){
	$("#updateWindow").dialog('open').dialog('center');
}
<#if ret??>
$.messager.show({
	title:'信息提示',
	msg:'${ret}'
});
</#if>
</script>
